#include "emis.h"
#include "service_mode_impl.h"
#include "service_ctrl_impl.h"
#include "service_view_impl.h"
#include "manager_mode_impl.h"
#include "manager_ctrl_impl.h"
#include "manager_view_impl.h"


int main(int argc,const char* argv[])
{
	clear_screen();
	printf("欢迎来到指针公司管理系统\n您可以使用方向键控制选项指针移动，回车键确认选项\n管理子系统账号默认是zzxx，密码默认是123456\n在输入中按Tab键可以切换显示输入/隐藏输入\n");
	anykey_continue();
	readIds();
	ServiceModeImpl* smi =  new ServiceModeImpl();
	ServiceMode* sm = smi;
	ServiceCtrlImpl* sci = new ServiceCtrlImpl(sm);
	ServiceCtrl* sc = sci;
	ServiceViewImpl* svi = new ServiceViewImpl(sc);
	ServiceView* sv = svi;
	ManagerModeImpl* mmi = new ManagerModeImpl();
	ManagerMode* mm = mmi;
	ManagerCtrlImpl* mci = new ManagerCtrlImpl(mm);
	ManagerCtrl* mc = mci;
	
	ManagerViewImpl* mvi = new ManagerViewImpl(mc,sv);
	clear_screen();
	vector<string> str;
	str.push_back("超级管理员登录");
	str.push_back("运营管理员登录");
	str.push_back("退出系统");
	int cmd = -1;
	while(cmd!=2)
	{
		clear_screen();
		clear();
		switch(cmd = get_cmd(str))
		{
			case 0: mvi->loginManager(); break;
			case 1: mvi->loginService(); break;
			default:break;
		}
	}
	delete mci;
	delete mvi;
	delete mmi;
	delete svi;
	delete sci;
	delete smi;
	saveIds();
}
